<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\Theme
 *
 * @property int $id
 * @property string $name
 * @property string $description
 * @property int $topic_img_id
 * @property int $head_img_id
 * @property \Carbon\Carbon|null $created_at
 * @property \Carbon\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Theme whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Theme whereDescription($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Theme whereHeadImgId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Theme whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Theme whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Theme whereTopicImgId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Theme whereUpdatedAt($value)
 * @mixin \Eloquent
 */
class Theme extends Model
{
    /**
     * @var array
     */
    protected $hidden = ['created_at', 'updated_at', 'head_img_id', 'topic_img_id'];
    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function topicImg()
    {
        return $this->hasOne('App\Models\Images', 'id', 'topic_img_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function headImg()
    {
        return $this->hasOne('App\Models\Images', 'id', 'head_img_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function products()
    {
        return $this->belongsToMany('App\Models\Product', 'theme_products', 'theme_id', 'product_id');
    }
}
